/*
 * @Author: nainaiyi s15037075861@163.com
 * @Date: 2022-07-12 15:29:44
 * @LastEditors: nainaiyi s15037075861@163.com
 * @LastEditTime: 2022-09-05 15:53:49
 * @FilePath: \网站2001A尚盈盈7.12月考\demo\src\store\home\homeAction.ts
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { homeListType } from "../home/homeReducer"
export const fetch_add_data = "fetch_add_data"
export const fetch_count = "fetch_count"
export const fetch_isChecked = "fetch_isChecked"
export const fetch_AllChecked = "fetch_AllChecked"

export interface fetchAddData {
    type: typeof fetch_add_data,
    payload: homeListType
}
export const fetchAddDataAction = (payload: homeListType): fetchAddData => {
    return {
        type: fetch_add_data,
        payload
    }
}

export interface fetchCountData {
    type: typeof fetch_count,
    count: number,
    id: string
}
export const fetchCountAction = (count: number, id: string): fetchCountData => {
    return {
        type: fetch_count,
        count,
        id
    }
}

export interface fetchIscheckEd {
    type: typeof fetch_isChecked,
    isChecked: boolean,
    id: string
}
export const fetchIsCheckedAction = (isChecked: boolean, id: string): fetchIscheckEd => {
    return {
        type: fetch_isChecked,
        isChecked,
        id
    }
}

export interface fetchAllChecked {
    type: typeof fetch_AllChecked,
    payload: boolean
}
export function fetchAllCheckedAction(payload: boolean): fetchAllChecked {
    return { type: fetch_AllChecked, payload }
}


export type ShopAction = fetchAddData | fetchCountData | fetchIscheckEd | fetchAllChecked